<template>
  <div class="operating_password">
    <Modal
      @on-ok="operation_password"
      :ok-text="$t('views.public.sure')"
      :cancel-text="$t('views.public.cancel')"
      v-model="modal2"
      title="输入操作密码，并确认"
    >
<!--      <i-input :type="modal2?'password':''" v-model="reason"></i-input>-->
    </Modal>
  </div>
</template>

<script>
  export default {
    name: "operating_password",

    components: {},
    props: {
      value: {}
    },
    data() {
      return {
        reason: '',
        modal2: false
      }
    },
    created() {
    },
    methods: {
      operation_password() {
        let data = {
          op: 'operation_password',
          password: this.reason,
        }

        this.$http.password_check(data, {
          method: this.operation_password,
          that: this,
        }).then((res) => {
          if (Number(res.status) == 200) {
            let inspection_time = new Date()
            localStorage.setItem('inspection_time', inspection_time.getTime())
            this.$emit("perform")
            this.reason = ''

          } else {
            this.$Message.error(res.msg)
          }
        })
      },
    },
    watch: {
      value(val) {
        this.modal2 = val
      },
      modal2(val) {
        this.$emit('input', val)
      }
    }
  }
</script>
<style scoped lang="scss">
  @function r($px) {
    @return $px/100*1rem;
  }
</style>
